import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('user', () => {
  const token = ref('')
  const username = ref('')
  const permissions = ref<string[]>([])

  const login = async (loginUsername: string, password: string) => {
    // TODO: 实现登录API调用
    username.value = loginUsername
    token.value = 'dummy-token'
    permissions.value = ['system:user:view']
  }

  const logout = async () => {
    // TODO: 实现登出API调用
    token.value = ''
    username.value = ''
    permissions.value = []
  }

  return {
    token,
    username,
    permissions,
    login,
    logout
  }
}) 